package com.lz.config.dal.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.lz.common.baseBean.CommonEntity;

@TableName("method_log")
public class MethodLog extends CommonEntity<String> {
    // 方法名
    private String methodName;
    // 调用者方法名称
    private String callerMethodName;
    //被调用次数
    private Integer num;


    public MethodLog() {
    }

    public MethodLog(String methodName, String callerMethodName, Integer num) {
        this.methodName = methodName;
        this.callerMethodName = callerMethodName;
        this.num = num;
    }

    /**
     * 获取
     *
     * @return methodName
     */
    public String getMethodName() {
        return methodName;
    }

    /**
     * 设置
     *
     * @param methodName
     */
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    /**
     * 获取
     *
     * @return callerMethodName
     */
    public String getCallerMethodName() {
        return callerMethodName;
    }

    /**
     * 设置
     *
     * @param callerMethodName
     */
    public void setCallerMethodName(String callerMethodName) {
        this.callerMethodName = callerMethodName;
    }

    /**
     * 获取
     *
     * @return num
     */
    public Integer getNum() {
        return num;
    }

    /**
     * 设置
     *
     * @param num
     */
    public void setNum(Integer num) {
        this.num = num;
    }

    public void addNum(Integer num) {
        if (this.num == null) {
            this.num = 0;
        }
        this.num = this.num + num;
    }

    public String toString() {
        return "MethodLog{methodName = " + methodName + ", callerMethodName = " + callerMethodName + ", num = " + num + "}";
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        MethodLog other = (MethodLog) obj;
        if (methodName == null) {
            if (other.methodName != null) return false;
        } else if (!methodName.equals(other.methodName)) return false;
        if (callerMethodName == null) {
            if (other.callerMethodName != null) return false;
        } else if (!callerMethodName.equals(other.callerMethodName)) return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((methodName == null) ? 0 : methodName.hashCode());
        result = prime * result + ((callerMethodName == null) ? 0 : callerMethodName.hashCode());
        return result;
    }
}
